
'===============================================================================
'  Generated From - MySQL4_VBNet_BusinessEntity.vbgen
'
'  The supporting base class MySql4Entity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.1.3.5)

Imports System
Imports System.Data
Imports MySql.Data.MySqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace MyGeneration.dOOdads.Tests.MySql4

Public MustInherit Class _aggregatetest
	Inherits MySql4Entity

		Public Sub New() 
			Me.QuerySource = "aggregatetest"
			Me.MappingName = "aggregatetest"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
	Public Overrides Function GetAutoKeyColumns() As String
			Return "ID"
	End Function
	
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
	    return Me.Query.Load()
		
	End Function


	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
	Public Overridable Function LoadByPrimaryKey(ByVal ID As Integer) As Boolean

		Me.Where.ID.Value = ID
		
		Return Me.Query.Load()

	End Function
	

	#Region "Parameters"
	Protected class Parameters 
		
		Public Shared ReadOnly Property ID As MySqlParameter
			Get
				Return New MySqlParameter("?ID", MySqlDbType.Int32, 0)
			End Get
		End Property
		
		Public Shared ReadOnly Property DepartmentID As MySqlParameter
			Get
				Return New MySqlParameter("?DepartmentID", MySqlDbType.Int32, 0)
			End Get
		End Property
		
		Public Shared ReadOnly Property FirstName As MySqlParameter
			Get
				Return New MySqlParameter("?FirstName", MySqlDbType.VarChar, 25)
			End Get
		End Property
		
		Public Shared ReadOnly Property LastName As MySqlParameter
			Get
				Return New MySqlParameter("?LastName", MySqlDbType.VarChar, 15)
			End Get
		End Property
		
		Public Shared ReadOnly Property Age As MySqlParameter
			Get
				Return New MySqlParameter("?Age", MySqlDbType.Int32, 0)
			End Get
		End Property
		
		Public Shared ReadOnly Property HireDate As MySqlParameter
			Get
				Return New MySqlParameter("?HireDate", MySqlDbType.Datetime, 0)
			End Get
		End Property
		
		Public Shared ReadOnly Property Salary As MySqlParameter
			Get
				Return New MySqlParameter("?Salary", MySqlDbType.Decimal, 0)
			End Get
		End Property
		
		Public Shared ReadOnly Property IsActive As MySqlParameter
			Get
				Return New MySqlParameter("?IsActive", MySqlDbType.Byte, 0)
			End Get
		End Property
		
	End Class
	#End Region	

	#Region "ColumnNames"
	Public class ColumnNames
		
        Public Const ID As String = "ID"
        Public Const DepartmentID As String = "DepartmentID"
        Public Const FirstName As String = "FirstName"
        Public Const LastName As String = "LastName"
        Public Const Age As String = "Age"
        Public Const HireDate As String = "HireDate"
        Public Const Salary As String = "Salary"
        Public Const IsActive As String = "IsActive"

		Shared Public Function ToPropertyName(ByVal columnName As String) As String

			If ht Is Nothing Then
			
				ht = new Hashtable
				
				ht(ID) = _aggregatetest.PropertyNames.ID
				ht(DepartmentID) = _aggregatetest.PropertyNames.DepartmentID
				ht(FirstName) = _aggregatetest.PropertyNames.FirstName
				ht(LastName) = _aggregatetest.PropertyNames.LastName
				ht(Age) = _aggregatetest.PropertyNames.Age
				ht(HireDate) = _aggregatetest.PropertyNames.HireDate
				ht(Salary) = _aggregatetest.PropertyNames.Salary
				ht(IsActive) = _aggregatetest.PropertyNames.IsActive

			End If
			
			Return CType(ht(columnName), String)
			
		End Function
		
		Shared Private ht  As Hashtable = Nothing		 
	End Class
	#End Region	
	
	#Region "PropertyNames"
	Public class PropertyNames
		
        Public Const ID As String = "ID"
        Public Const DepartmentID As String = "DepartmentID"
        Public Const FirstName As String = "FirstName"
        Public Const LastName As String = "LastName"
        Public Const Age As String = "Age"
        Public Const HireDate As String = "HireDate"
        Public Const Salary As String = "Salary"
        Public Const IsActive As String = "IsActive"

		Shared Public Function ToColumnName(ByVal propertyName As String) As String

			If ht Is Nothing Then
			
				ht = new Hashtable
				
				ht(ID) = _aggregatetest.ColumnNames.ID
				ht(DepartmentID) = _aggregatetest.ColumnNames.DepartmentID
				ht(FirstName) = _aggregatetest.ColumnNames.FirstName
				ht(LastName) = _aggregatetest.ColumnNames.LastName
				ht(Age) = _aggregatetest.ColumnNames.Age
				ht(HireDate) = _aggregatetest.ColumnNames.HireDate
				ht(Salary) = _aggregatetest.ColumnNames.Salary
				ht(IsActive) = _aggregatetest.ColumnNames.IsActive

			End If
			
			Return CType(ht(propertyName), String)
			
		End Function
		
		Shared Private ht  As Hashtable = Nothing
		
	End Class
	#End Region	
	
	#Region "StringPropertyNames"
	Public class StringPropertyNames
		
        Public Const ID As String = "s_ID"
        Public Const DepartmentID As String = "s_DepartmentID"
        Public Const FirstName As String = "s_FirstName"
        Public Const LastName As String = "s_LastName"
        Public Const Age As String = "s_Age"
        Public Const HireDate As String = "s_HireDate"
        Public Const Salary As String = "s_Salary"
        Public Const IsActive As String = "s_IsActive"

	End Class
	#End Region		
	
	#Region "Properties" 
		Public Overridable Property ID As Integer
			Get
				Return MyBase.GetInteger(ColumnNames.ID)
			End Get
			Set(ByVal Value As Integer)
				MyBase.SetInteger(ColumnNames.ID, Value)
			End Set
		End Property

		Public Overridable Property DepartmentID As Integer
			Get
				Return MyBase.GetInteger(ColumnNames.DepartmentID)
			End Get
			Set(ByVal Value As Integer)
				MyBase.SetInteger(ColumnNames.DepartmentID, Value)
			End Set
		End Property

		Public Overridable Property FirstName As String
			Get
				Return MyBase.GetString(ColumnNames.FirstName)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.FirstName, Value)
			End Set
		End Property

		Public Overridable Property LastName As String
			Get
				Return MyBase.GetString(ColumnNames.LastName)
			End Get
			Set(ByVal Value As String)
				MyBase.SetString(ColumnNames.LastName, Value)
			End Set
		End Property

		Public Overridable Property Age As Integer
			Get
				Return MyBase.GetInteger(ColumnNames.Age)
			End Get
			Set(ByVal Value As Integer)
				MyBase.SetInteger(ColumnNames.Age, Value)
			End Set
		End Property

		Public Overridable Property HireDate As DateTime
			Get
				Return MyBase.GetDateTime(ColumnNames.HireDate)
			End Get
			Set(ByVal Value As DateTime)
				MyBase.SetDateTime(ColumnNames.HireDate, Value)
			End Set
		End Property

		Public Overridable Property Salary As Decimal
			Get
				Return MyBase.GetDecimal(ColumnNames.Salary)
			End Get
			Set(ByVal Value As Decimal)
				MyBase.SetDecimal(ColumnNames.Salary, Value)
			End Set
		End Property

		Public Overridable Property IsActive As Byte
			Get
				Return MyBase.GetByte(ColumnNames.IsActive)
			End Get
			Set(ByVal Value As Byte)
				MyBase.SetByte(ColumnNames.IsActive, Value)
			End Set
		End Property


	#End Region  
	
	#Region "String Properties" 

		Public Overridable Property s_ID As String
			Get
				If Me.IsColumnNull(ColumnNames.ID) Then
					Return String.Empty
				Else
					Return MyBase.GetIntegerAsString(ColumnNames.ID)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.ID)
				Else
					Me.ID = MyBase.SetIntegerAsString(ColumnNames.ID, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_DepartmentID As String
			Get
				If Me.IsColumnNull(ColumnNames.DepartmentID) Then
					Return String.Empty
				Else
					Return MyBase.GetIntegerAsString(ColumnNames.DepartmentID)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.DepartmentID)
				Else
					Me.DepartmentID = MyBase.SetIntegerAsString(ColumnNames.DepartmentID, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FirstName As String
			Get
				If Me.IsColumnNull(ColumnNames.FirstName) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.FirstName)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FirstName)
				Else
					Me.FirstName = MyBase.SetStringAsString(ColumnNames.FirstName, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_LastName As String
			Get
				If Me.IsColumnNull(ColumnNames.LastName) Then
					Return String.Empty
				Else
					Return MyBase.GetStringAsString(ColumnNames.LastName)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.LastName)
				Else
					Me.LastName = MyBase.SetStringAsString(ColumnNames.LastName, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Age As String
			Get
				If Me.IsColumnNull(ColumnNames.Age) Then
					Return String.Empty
				Else
					Return MyBase.GetIntegerAsString(ColumnNames.Age)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Age)
				Else
					Me.Age = MyBase.SetIntegerAsString(ColumnNames.Age, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_HireDate As String
			Get
				If Me.IsColumnNull(ColumnNames.HireDate) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.HireDate)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.HireDate)
				Else
					Me.HireDate = MyBase.SetDateTimeAsString(ColumnNames.HireDate, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Salary As String
			Get
				If Me.IsColumnNull(ColumnNames.Salary) Then
					Return String.Empty
				Else
					Return MyBase.GetDecimalAsString(ColumnNames.Salary)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Salary)
				Else
					Me.Salary = MyBase.SetDecimalAsString(ColumnNames.Salary, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IsActive As String
			Get
				If Me.IsColumnNull(ColumnNames.IsActive) Then
					Return String.Empty
				Else
					Return MyBase.GetByteAsString(ColumnNames.IsActive)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IsActive)
				Else
					Me.IsActive = MyBase.SetByteAsString(ColumnNames.IsActive, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property ID() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.ID, Parameters.ID)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property DepartmentID() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.DepartmentID, Parameters.DepartmentID)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FirstName() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.FirstName, Parameters.FirstName)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property LastName() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.LastName, Parameters.LastName)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Age() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.Age, Parameters.Age)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property HireDate() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.HireDate, Parameters.HireDate)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Salary() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.Salary, Parameters.Salary)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IsActive() As WhereParameter
			Get
				Dim where As WhereParameter = New WhereParameter(ColumnNames.IsActive, Parameters.IsActive)
				Me._clause._entity.Query.AddWhereParemeter(where)
				Return where
			End Get
		End Property


		Private _clause as WhereClause
	End Class
	#End Region	

		Public ReadOnly Property ID() As WhereParameter 
			Get
				If _ID_W Is Nothing Then
					_ID_W = TearOff.ID
				End If
				Return _ID_W
			End Get
		End Property

		Public ReadOnly Property DepartmentID() As WhereParameter 
			Get
				If _DepartmentID_W Is Nothing Then
					_DepartmentID_W = TearOff.DepartmentID
				End If
				Return _DepartmentID_W
			End Get
		End Property

		Public ReadOnly Property FirstName() As WhereParameter 
			Get
				If _FirstName_W Is Nothing Then
					_FirstName_W = TearOff.FirstName
				End If
				Return _FirstName_W
			End Get
		End Property

		Public ReadOnly Property LastName() As WhereParameter 
			Get
				If _LastName_W Is Nothing Then
					_LastName_W = TearOff.LastName
				End If
				Return _LastName_W
			End Get
		End Property

		Public ReadOnly Property Age() As WhereParameter 
			Get
				If _Age_W Is Nothing Then
					_Age_W = TearOff.Age
				End If
				Return _Age_W
			End Get
		End Property

		Public ReadOnly Property HireDate() As WhereParameter 
			Get
				If _HireDate_W Is Nothing Then
					_HireDate_W = TearOff.HireDate
				End If
				Return _HireDate_W
			End Get
		End Property

		Public ReadOnly Property Salary() As WhereParameter 
			Get
				If _Salary_W Is Nothing Then
					_Salary_W = TearOff.Salary
				End If
				Return _Salary_W
			End Get
		End Property

		Public ReadOnly Property IsActive() As WhereParameter 
			Get
				If _IsActive_W Is Nothing Then
					_IsActive_W = TearOff.IsActive
				End If
				Return _IsActive_W
			End Get
		End Property

		Private _ID_W As WhereParameter = Nothing
		Private _DepartmentID_W As WhereParameter = Nothing
		Private _FirstName_W As WhereParameter = Nothing
		Private _LastName_W As WhereParameter = Nothing
		Private _Age_W As WhereParameter = Nothing
		Private _HireDate_W As WhereParameter = Nothing
		Private _Salary_W As WhereParameter = Nothing
		Private _IsActive_W As WhereParameter = Nothing

		Public Sub WhereClauseReset()

		_ID_W = Nothing
		_DepartmentID_W = Nothing
		_FirstName_W = Nothing
		_LastName_W = Nothing
		_Age_W = Nothing
		_HireDate_W = Nothing
		_Salary_W = Nothing
		_IsActive_W = Nothing
			Me._entity.Query.FlushWhereParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property ID() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.ID, Parameters.ID)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property DepartmentID() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.DepartmentID, Parameters.DepartmentID)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FirstName() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FirstName, Parameters.FirstName)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property LastName() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.LastName, Parameters.LastName)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Age() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Age, Parameters.Age)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property HireDate() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.HireDate, Parameters.HireDate)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Salary() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Salary, Parameters.Salary)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IsActive() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IsActive, Parameters.IsActive)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property ID() As AggregateParameter 
			Get
				If _ID_W Is Nothing Then
					_ID_W = TearOff.ID
				End If
				Return _ID_W
			End Get
		End Property

		Public ReadOnly Property DepartmentID() As AggregateParameter 
			Get
				If _DepartmentID_W Is Nothing Then
					_DepartmentID_W = TearOff.DepartmentID
				End If
				Return _DepartmentID_W
			End Get
		End Property

		Public ReadOnly Property FirstName() As AggregateParameter 
			Get
				If _FirstName_W Is Nothing Then
					_FirstName_W = TearOff.FirstName
				End If
				Return _FirstName_W
			End Get
		End Property

		Public ReadOnly Property LastName() As AggregateParameter 
			Get
				If _LastName_W Is Nothing Then
					_LastName_W = TearOff.LastName
				End If
				Return _LastName_W
			End Get
		End Property

		Public ReadOnly Property Age() As AggregateParameter 
			Get
				If _Age_W Is Nothing Then
					_Age_W = TearOff.Age
				End If
				Return _Age_W
			End Get
		End Property

		Public ReadOnly Property HireDate() As AggregateParameter 
			Get
				If _HireDate_W Is Nothing Then
					_HireDate_W = TearOff.HireDate
				End If
				Return _HireDate_W
			End Get
		End Property

		Public ReadOnly Property Salary() As AggregateParameter 
			Get
				If _Salary_W Is Nothing Then
					_Salary_W = TearOff.Salary
				End If
				Return _Salary_W
			End Get
		End Property

		Public ReadOnly Property IsActive() As AggregateParameter 
			Get
				If _IsActive_W Is Nothing Then
					_IsActive_W = TearOff.IsActive
				End If
				Return _IsActive_W
			End Get
		End Property

		Private _ID_W As AggregateParameter = Nothing
		Private _DepartmentID_W As AggregateParameter = Nothing
		Private _FirstName_W As AggregateParameter = Nothing
		Private _LastName_W As AggregateParameter = Nothing
		Private _Age_W As AggregateParameter = Nothing
		Private _HireDate_W As AggregateParameter = Nothing
		Private _Salary_W As AggregateParameter = Nothing
		Private _IsActive_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_ID_W = Nothing
		_DepartmentID_W = Nothing
		_FirstName_W = Nothing
		_LastName_W = Nothing
		_Age_W = Nothing
		_HireDate_W = Nothing
		_Salary_W = Nothing
		_IsActive_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

			
		
	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As New MySqlCommand
		cmd.CommandType = CommandType.Text
		cmd.CommandText = "" & _
"INSERT INTO `aggregatetest`" & _
"(" & _
	"`DepartmentID`," & _
	"`FirstName`," & _
	"`LastName`," & _
	"`Age`," & _
	"`HireDate`," & _
	"`Salary`," & _
	"`IsActive`" & _
")" & _
"VALUES" & _
"(" & _
	"?DepartmentID," & _
	"?FirstName," & _
	"?LastName," & _
	"?Age," & _
	"?HireDate," & _
	"?Salary," & _
	"?IsActive" & _
")"

		CreateParameters(cmd)
		Return cmd
	End Function

	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As New MySqlCommand
		cmd.CommandType = CommandType.Text
		cmd.CommandText = "" & _
"UPDATE `aggregatetest` SET " & _
	"`DepartmentID`=?DepartmentID," & _
	"`FirstName`=?FirstName," & _
	"`LastName`=?LastName," & _
	"`Age`=?Age," & _
	"`HireDate`=?HireDate," & _
	"`Salary`=?Salary," & _
	"`IsActive`=?IsActive" & _
" WHERE " & _ 
	"`ID`=?ID"

		CreateParameters(cmd)
		Return cmd
	End Function

	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As New MySqlCommand
		cmd.CommandType = CommandType.Text
		cmd.CommandText = "" & _
"DELETE FROM `aggregatetest` " & _
" WHERE " & _
	"`ID`=?ID"

		Dim p As MySqlParameter
		p = cmd.Parameters.Add(Parameters.ID)
		p.SourceColumn = ColumnNames.ID
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	End Function
	
	Private Sub CreateParameters(ByVal cmd As MySqlCommand)
	
		Dim p As MySqlParameter
		p = cmd.Parameters.Add(Parameters.ID)
		p.SourceColumn = ColumnNames.ID
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.DepartmentID)
		p.SourceColumn = ColumnNames.DepartmentID
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FirstName)
		p.SourceColumn = ColumnNames.FirstName
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.LastName)
		p.SourceColumn = ColumnNames.LastName
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Age)
		p.SourceColumn = ColumnNames.Age
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.HireDate)
		p.SourceColumn = ColumnNames.HireDate
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Salary)
		p.SourceColumn = ColumnNames.Salary
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IsActive)
		p.SourceColumn = ColumnNames.IsActive
		p.SourceVersion = DataRowVersion.Current


	End Sub		
	


End Class


End NameSpace

